package display
{
	import controller.Controller;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	import events.DisplayEvent;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.geom.ColorTransform;
	
	
	public class DisplayPlayer extends MovieClip
	{
		private var control:Controller;
		private var sh:Shell;
		
		private var data:Array;
		
		private static var width:int = 768;
		private static var height:int = 450;
		
		private var myColor:ColorTransform = new ColorTransform;
		
		// display items
		
		private var displayApplicationBg:DisplayApplicationBackground;
		private var displayBg:DisplayBackGround;
		private var displayMenu:DisplayMenu;
		private var displayMediaPlayer:DisplayMediaPlayer;
		private var displayContentList:DisplayContentList;
		private var displayFeatureList:DisplayFeatureList;
		private var displayControls:DisplayControls;
		private var displaySearchField:DisplaySearchField;
		
		// player holder
		
		
		private var holder:Sprite;
		
		public function DisplayPlayer(shell:Shell,ctr:Controller,_data:Array)
		{
			sh = shell;
			data = _data;
			control = ctr;
			
			ini();
		}
		
		private function ini():void
		{
			build();
			
			align();
			
			sh.stage.addEventListener(Event.RESIZE, onStageResize);
		}
		
		private function onStageResize(e:Event):void
		{
			align();
		}
		
		private function align():void
		{
			var offset:Number = 200;
			
			holder.x = (((sh.stage.stageWidth  - 200)/ 2) - ((785 )/ 2)) ;
			holder.y = (((sh.stage.stageHeight)/ 2) - ((498 )/ 2)) ;
		}
		
		private function build():void
		{
			holder = new Sprite;
			
			displayApplicationBg = new DisplayApplicationBackground(control, sh);
			displayBg = new DisplayBackGround(control);
			displayMenu = new DisplayMenu(control);
			displayMediaPlayer = new DisplayMediaPlayer(control,sh,displayApplicationBg);
			displayContentList = new DisplayContentList(control,sh,displayApplicationBg);
			displayFeatureList = new DisplayFeatureList(control);
			displayControls = new DisplayControls(control, sh);
			displaySearchField = new DisplaySearchField(control);
			
			addChild(displayApplicationBg);
		    addChild(holder);
			addChild(displayControls);
			
			holder.addChild(displayBg);
			holder.addChild(displayMenu);
			holder.addChild(displayMediaPlayer);
			holder.addChild(displayContentList);
			holder.addChild(displayFeatureList);
			holder.addChild(displaySearchField);
		}
	}
}